<?php
class HKShop_Plugin_Module extends Zend_Controller_Plugin_Abstract {
    
    public function preDispatch(Zend_Controller_Request_Abstract $request) {
        
        // Set layout for each module
        $module = $request->getModuleName();
        $controller = $request->getControllerName();
        $layout = Zend_Layout::getMvcInstance();
        
        // Error page is disable layout
        if($controller != "error") {     
            $layout->setLayoutPath($layout->getLayoutPath().$module);
        }else{
            $layout->disableLayout();
        }
    }
    
}
?>